home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Advisor / CD-ROM Advisor.iso / prodemo / pdymain.dir / 00001_Script_1 next >
Text File  |  1995-09-29  |  5KB  |  148 lines

  1. on startMovie
  2.   --it is important that this executes on returns from the opening movie and the animations
  3.   --after these returns, this resets the state of the menu
  4.   global gNumberOfMainButtons
  5.   global gCentersOfMainButtons, gMagicOffsetsOfMainButtons, gCastMemsOfMainButtons, gAniHasBeenViewed
  6.   global gRadiusOfMainButton
  7.   global gMagicH1, gMagicH2, gMagicV1, gMagicV2 --define regions for hit detection
  8.   global gAnisForMainButtons  --names of Director movies (animations)
  9.   
  10.   global gNumberOfSmallButtons
  11.   global gCentersOfSmallButtons, gMagicOffsetsOfSmallButtons, gCastMemsOfSmallButtons, gLabelsForSmallButtonActions
  12.   global gRadiusOfSmallButtons
  13.   
  14.   global gIndexOfCurrentButton
  15.   global gMouseDownInButton  --TRUE means down was in a button...in case of rollout
  16.   global gSmallButtonsOn  --TRUE means that the small buttons are visible and active
  17.   global gIsMainButton, gIsSmallButton  --makes gIndexOfCurr... relative to main or small button
  18.   
  19.   global gChannelForHighLights, gChannelForFreeFlash
  20.   global gFreeFlashTimerBase
  21.   global gNextLabel
  22.   global gMovieToPlay
  23.   
  24.   --$$$ start
  25.   global gCursorIsHand
  26.   put FALSE into gCursorIsHand
  27.   --$$$ end
  28.   
  29.   put 4 into gChannelForHighLights
  30.   set the puppet of sprite gChannelForHighLights to TRUE
  31.   set the visible of sprite gChannelForHighLights to FALSE
  32.   
  33.   put 3 into gChannelForFreeFlash
  34.   set the puppet of sprite gChannelForFreeFlash to TRUE
  35.   set the visible of sprite gChannelForFreeFlash to FALSE
  36.   
  37.   put 0 into gIndexOfCurrentButton
  38.   put FALSE into gMouseDownInButton
  39.   put FALSE into gIsMainButton
  40.   put FALSE into gIsSmallButton
  41.   
  42.   put FALSE into gMovieToPlay
  43.   
  44.   -- in case this is the first frame after a return  
  45.   -- from a movie, set cursor
  46.   cursor -1  -- pointer cursor  
  47.   
  48.   --startTimer
  49.   put the timer into gFreeFlashTimerBase
  50.   
  51.   
  52. end startMovie
  53.  
  54. on isPositionWithinMainButton hPos, vPos
  55.   --if the position is within a main button, return its index
  56.   global gMagicH1, gMagicH2, gMagicV1, gMagicV2
  57.   
  58.   put 0 into indexOfButton
  59.   
  60.   --if it's in the right region do the distance test
  61.   if hPos < gMagicH1 then
  62.     -- might be Edna or Dylan
  63.     if vPos < gMagicV1 then
  64.       --might be Edna, ie index 2
  65.       if (isWithinThisMainButton(2, hPos, vPos)) then
  66.         put 2 into indexOfButton
  67.       end if
  68.     else
  69.       --might be Dylan, ie index 1
  70.       if(isWithinThisMainButton(1, hPos, vPos)) then
  71.         put 1 into indexOfButton
  72.       end if
  73.     end if
  74.   else
  75.     --might be Loni, Rol or WildB
  76.     if vPos < gMagicV1 then
  77.       --might be Loni or Roland
  78.       if hPos < gMagicH2 then
  79.         --might be Loni
  80.         if (isWithinThisMainButton(3, hPos, vPos))then
  81.           put 3 into indexOfButton
  82.         end if
  83.       else
  84.         if (isWithinThisMainButton(4, hPos, vPos))then
  85.           put 4 into indexOfButton
  86.         end if
  87.       end if
  88.     else
  89.       --might be WildB
  90.       if (isWithinThisMainButton(5, hPos, vPos))then
  91.         put 5 into indexOfButton
  92.       end if
  93.     end if
  94.   end if
  95.   
  96.   return indexOfButton
  97.   
  98. end isPositionWithinMainButton
  99.  
  100. on isWithinThisMainButton index, h, v
  101.   global gCentersOfMainButtons
  102.   global gRadiusOfMainButton
  103.   
  104.   put getAt(gCentersOfMainButtons, index) into centerTemp
  105.   put (getAt(centerTemp, 1) - h) into hComp
  106.   put (getAt(centerTemp, 2) - v) into vComp
  107.   put (sqrt((hComp * hComp) + (vComp * vComp)) < gRadiusOfMainButton) into r
  108.   return r
  109.   
  110. end isWithinThisMainButton
  111.  
  112. on isPositionWithinSmallButton hPos, vPos
  113.   --if the position is within a small button, return its index
  114.   global gMagicH1, gMagicH2, gMagicV1, gMagicV2
  115.   
  116.   put 0 into indexOfButton
  117.   
  118.   if vPos > gMagicV2 then
  119.     --might be exit or free buttons
  120.     if hPos < gMagicH1 then
  121.       --might be freetime button
  122.       if isWithinThisSmallButton(1, hPos, vPos) then
  123.         put 1 into indexOfButton
  124.       end if
  125.     else
  126.       if isWithinThisSmallButton (2, hPos, vPos) then
  127.         put 2 into indexOfButton
  128.       end if
  129.     end if
  130.   end if
  131.   
  132.   return indexOfButton
  133.   
  134. end isPositionWithinSmallButton
  135.  
  136.  
  137. on isWithinThisSmallButton index, h, v
  138.   global gCentersOfSmallButtons
  139.   global gRadiusOfSmallButtons
  140.   
  141.   put getAt(gCentersOfSmallButtons, index) into centerTemp
  142.   put (getAt(centerTemp, 1) - h) into hComp
  143.   put (getAt(centerTemp, 2) - v) into vComp
  144.   put (sqrt((hComp * hComp) + (vComp * vComp)) < gRadiusOfSmallButtons) into r
  145.   return r
  146.   
  147. end isWithinThisSmallButton
  148.